package com.example.testlxr9096;

import android.os.SystemClock;
import android.view.View;

// 自定义防快速点击监听器
public abstract class ThrottleOnItemClickListener implements View.OnClickListener {
    private static final long THROTTLE_INTERVAL = 500; // 500ms 间隔
    private long lastClickTime = 0;

    @Override
    public void onClick(View v) {
        long currentTime = SystemClock.elapsedRealtime();
        if (currentTime - lastClickTime > THROTTLE_INTERVAL) {
            lastClickTime = currentTime;
            onThrottleClick(v);
        }
    }

    public abstract void onThrottleClick(View v);
}